import { ref } from "vue"
import { useRoute } from "vue-router"
// 获取数据
export function getRefData(fn, params = {}) {
    const refData = ref({});
    async function AsyncData() {
        refData.value = await fn(params);
    }

    AsyncData();
    return refData;
}

export function init(commonData) {
    const link = document.createElement("link");
    link.rel = "shortcut icon";
    link.href = commonData.favicon;
    document.head.appendChild(link);
}

export function setTitle() {
    const route = useRoute();
    document.title = route.meta?.title + '-初白的个人空间';
}